import request from '@/utils/request';

const client = '';

// 检测用户 - 检测手机号是否可用
export function checkNickname({ nickname } = {}) {
  return request({
    url: '/check_nickname',
    method: 'POST',
    data: { nickname },
  });
}
// 检测用户 - 检测用户昵称是否可用
export function checkPhone({ phone } = {}) {
  return request({
    url: '/check_phone',
    method: 'POST',
    data: { phone },
  });
}
// 检测用户 - 检测邮箱是否可用
export function checkEmail({ email } = {}) {
  return request({
    url: '/check_email',
    method: 'POST',
    data: { email },
  });
}
// 登录通行证 - 找回密码
export function resetPassword({
  email, phone, verifycode: verifyCode, password: newPassword,
} = {}) {
  return request({
    url: '/reset_password',
    method: 'POST',
    data: {
      email, phone, verifyCode, client, newPassword,
    },
  });
}
// 登录通行证 - 用户注册接口
export function register({
  nickname, password, verifycode: verifyCode, email, phone,
} = {}) {
  return request({
    url: '/register',
    method: 'POST',
    data: {
      email, phone, verifyCode, client, nickname, password,
    },
  });
}
// 登录通行证 - 密码登录
export function loginPassword({ email, phone, password } = {}) {
  return request({
    url: '/login_password',
    method: 'POST',
    data: {
      email, phone, password, client,
    },
  });
}
// 登录通行证 - 验证码登录
export function loginVerifycode({ email, phone, verifycode: verifyCode } = {}) {
  return request({
    url: '/login_verifycode',
    method: 'POST',
    data: {
      email, phone, verifyCode, client,
    },
  });
}
// 验证码 - 发送短信验证码
export function sendSMS({ phone } = {}) {
  return request({
    url: '/sendSMS',
    method: 'POST',
    data: { phone },
  });
}
// 验证码 - 发送邮件验证码
export function sendMail({ email } = {}) {
  return request({
    url: '/sendMail',
    method: 'POST',
    data: { email },
  });
}
